home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 June: Reference Library / Dev.CD Jun 99 RL Disk 1.toast / Technical Documentation / Develop / Additional Articles / Developing Symbiotic Apps / Symbiotic Samples / Symbiotic server source / flexibled & simpled / tridentd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-04  |  3.1 KB  |  122 lines  |  [TEXT/CWIE]

  1. /* trident.h - structures and #defines for tridentd project.
  2.  *
  3.  * %W%
  4.  *
  5.  * Original Author: Chris Jalbert
  6.  * Copyright 1996 Apple Computer, Inc.
  7.  * All Rights Reserved.
  8.  *
  9.  * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF APPLE COMPUTER, INC.
  10.  * The copyright notice above does not evidence any actual or
  11.  * intended publication of such source code.
  12.  *
  13.  * History:
  14.  */
  15.  
  16.  
  17. #ifndef _TRIDENT_H_
  18. #define _TRIDENT_H_
  19.  
  20.  
  21. /*** Necessary #includes ***/
  22. #include <time.h>
  23. #include <AppleEvents.h>
  24. #include <EPPC.h>
  25.  
  26. #ifdef _AIX
  27. #include <PPCToolBox.h>
  28. #else
  29. #include <PPCToolbox.h>
  30. #endif
  31.  
  32. #ifdef SIMPLIFIED
  33. # undef SIMPLIFIED
  34. # ifdef _AIX
  35. #  define SIMPLIFIED 1
  36. # else
  37. #  define SIMPLIFIED 0
  38. # endif    /* _AIX */
  39. #else
  40. # define SIMPLIFIED 0
  41. #endif    /* SIMPLIFIED */
  42.  
  43.  
  44. /*** Typedefs and Structures ***/
  45. typedef enum
  46.     {
  47.     ClientInvalid = -1,        /* Set before connection is made & after closed. */
  48.     ClientConnected,        /* Set in PPCInform callback before 1st AE. */
  49.     ClientReady                /* Set after version AE validates protocol. */
  50.     } ClientState ;
  51.  
  52. typedef struct tagClientStruct *ClientPtr ;
  53. typedef struct tagClientStruct
  54.     {
  55.     ClientPtr        qLink ;                /* Should be unused in multi-threaded version. */
  56.     ClientPtr        *parent ;            /* Modifiable address to head of list. */
  57.     PPCSessRefNum    session ;            /* AppleTalk socket to client. */
  58.     AEAddressDesc    target ;            /* Cached AEDesc target to client. */
  59.     long            serviceType ;        /* Differentiates service type. */
  60.     ClientState        state ;                /* Used between connection and validation AE's. */
  61.     int                clientID ;            /* Client's session ID. (Useless to daemon.) */
  62.     int                interval ;            /* Time between updates. */
  63.     int                missedHeartbeats ;    /* # HBs missed so far. */
  64.     time_t            lastExchange ;        /* Time of last comm to or from client. */
  65.     time_t            lastUpdate ;        /* Time of last update AE to client. */
  66.     time_t            nextUpdate ;        /* Time of next update to client. */
  67.     } ClientStruct ;
  68.  
  69.  
  70. /*** Globals ***/
  71. extern ClientPtr    UptimeClients, WhoClients ;
  72.  
  73.  
  74. /*** Constants ***/
  75. #define kSignature        'JVLN'    /* Application signature */
  76. #define kUptimeType        'updt'    /* PPC type for update */
  77. #define kWhoType        'who '    /* PPC type for who list */
  78.  
  79.  
  80. /*** Macros ***/
  81. #define PStringStr(pstr)    ((char *) &(pstr)[1])
  82. #define PStringLen(pstr)    (pstr)[0]
  83.  
  84.  
  85. /*** Function prototypes ***/
  86.  
  87. /* Functions in handlers.c. */
  88. extern OSErr InitAEStuff (long) ;
  89.  
  90. /* Functions in client.c. */
  91. extern ClientPtr NewClient (long) ;
  92. extern void ClientSetSession (ClientPtr, PPCSessRefNum) ;
  93. extern void ClientSetInterval (ClientPtr, int) ;
  94. extern long UpdateClients (void) ;
  95. extern ClientPtr FindClient (const AppleEvent *) ;
  96. extern void DeleteClient (ClientPtr) ;
  97.  
  98. /* Functions in status.c. */
  99. #ifdef _AIX
  100. extern void InitApp (void) ;
  101. #else
  102. #define InitApp()
  103. #endif    /* _AIX */
  104.  
  105. extern int GetUptimeString (char *, long) ;
  106. extern int GetWhoString (char *, long) ;
  107.  
  108. /* Functions in ppcstuff.c. */
  109. #if SIMPLIFIED
  110. #define CloseClient(cp) DeleteClient (cp)
  111. #define InitPPCStuff() noErr
  112. #define PPCTimeSlice() noErr
  113. #define PPCShutDown()
  114. #else
  115. extern OSErr CloseClient (ClientPtr) ;
  116. extern OSErr InitPPCStuff (void) ;
  117. extern OSErr PPCTimeSlice (void) ;
  118. extern OSErr PPCShutDown (void) ;
  119. #endif    /* SIMPLIFIED */
  120.  
  121. #endif    /* _TRIDENT_H_ */
  122.